/*
* Copyright 2008-2023 dexian.vip. All rights reserved.
* Support: http://www.dexian.vip
* License: http://www.dexian.vip/license
*/

package ${serviceImpl.basePackage};

import vip.dexian.core.base.service.BaseServiceImpl;
import vip.dexian.common.utils.CollectionUtils;
import group.vip.dexian.core.base.validation.Save;
import group.vip.dexian.core.base.validation.Update;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;

/**
*${modelMap.entityComment!}业务逻辑处理实现
*
* @author ${modelMap.author} ${modelMap.now}
*/
@Service ("${modelMap.unCapitalizeClassName}ServiceImpl")
@Slf4j
// TODO 代码自动生成与${modelMap.now}，代码生成完成后，请删除该TODO语句
public class ${modelMap.simpleClassName}ServiceImpl extends BaseServiceImpl <${modelMap.simpleClassName}, ${modelMap.simpleClassName}DTO, Long> implements ${modelMap.simpleClassName}Service {

/**
* ${modelMap.entityComment!}Dao
*/
@Resource (name = "${modelMap.unCapitalizeClassName}DaoImpl")
private ${modelMap.simpleClassName}Dao ${modelMap.unCapitalizeClassName}Dao;

/**
* command -> entity
*/
@Resource (name = "${modelMap.unCapitalizeClassName}CommandAssemblerImpl")
private ${modelMap.simpleClassName}CommandAssembler ${modelMap.unCapitalizeClassName}CommandAssembler;

/**
* 保存${modelMap.entityComment!}信息
*
* @param command
*         保存指令
*
* @return {@link ${modelMap.simpleClassName}}
*/
@Override
@Transactional (rollbackFor = Exception.class)
public ${modelMap.simpleClassName} save (${modelMap.simpleClassName}SaveCommand command) {
log.info("save command:{}", command);
${modelMap.simpleClassName} ${modelMap.unCapitalizeClassName} = this.${modelMap.unCapitalizeClassName}CommandAssembler.toSave(command, Save.class);
return super.save(${modelMap.unCapitalizeClassName});
}

/**
* 修改${modelMap.entityComment!}信息
*
* @param command
*         修改指令
* @return {@link ${modelMap.simpleClassName}}
*/
@Override
@Transactional (rollbackFor = Exception.class)
public ${modelMap.simpleClassName} update (${modelMap.simpleClassName}UpdateCommand command) {
log.info("update command:{}", command);
${modelMap.simpleClassName} ${modelMap.unCapitalizeClassName} = this.${modelMap.unCapitalizeClassName}CommandAssembler.toUpdate(command, Update.class);
return super.update(${modelMap.unCapitalizeClassName});
}
/**
* 根据id批量删除${modelMap.entityComment!}
*
* @param ids
* id列表
*/
@Override
@Transactional (rollbackFor = Exception.class)
public void delete (Long... ids) {

log.info("delete parameter:{}", ids);

this.validDelete(ids);
List
<Long> distinctIds = CollectionUtils.distinct(ids);
    super.delete(distinctIds);
    }

    }
